%% Author: OSEA
%% Created: 2011 9 1
%% Description: TODO: Add description to echo
-module(echo).

%%
%% Include files
%%

%%
%% Exported Functions
%%
-export([go/0, loop/0]).

%%
%% API Functions
%%

go() ->
	Pid2 = spawn(echo, loop, []),
	Pid2 ! {self(), hello},
	receive
		{Pid2, Msg} ->
			io:format("P1 ~w~n", [Msg])
	end,
	Pid2 ! stop.

%%
%% Local Functions
%%

loop() ->
	receive
		{From, Msg} ->
			From ! {self(), Msg},
			loop();
		stop ->
			true
	end.
